package xhwl.insurance.adapter;

import android.content.Context;
import android.util.Log;
import android.view.View;

import java.util.List;

import xhwl.insurance.R;
import xhwl.insurance.http.bean.resp.UserGuideListResp;
import xhwl.pulltorefresh.adapter.BaseAdapter;
import xhwl.pulltorefresh.adapter.ViewHolder;

public class CustomerServiceAdapter extends BaseAdapter<UserGuideListResp> {
    private static final String TAG="CustomerServiceAdapter";
    OnItemClickLitener onItemClickLitener;

    @Override
    public int getItemCount() {
        Log.d(TAG,super.getItemCount()+"");
        return super.getItemCount();
    }

    public CustomerServiceAdapter(Context context, List<UserGuideListResp> datas) {
        super(context, R.layout.adapter_customerservice, datas);

    }
    @Override
    public void convert(ViewHolder holder, UserGuideListResp userGuideListResp) {
        holder.setText(R.id.tvProblem,userGuideListResp.getTitle());
        final int pos = holder.getLayoutPosition();
        if(onItemClickLitener!=null){
            holder.itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    onItemClickLitener.onItemClick(pos-1);
                }
            });
        }
    }
    public interface OnItemClickLitener {
        void onItemClick(int position);
    }

    public void setOnItemClickLitener(OnItemClickLitener onItemClickLitener) {
        this.onItemClickLitener = onItemClickLitener;
    }
}

